package g_stream;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;

/*
    集合获取流的方式
 */
public class CollectionStreamDemo {
    public static void main(String[] args) {
        //List
        List<String> list = List.of("张三", "李四", "王五");
        Stream<String> streamList = list.stream();

        //Set
        Set<String> set = Set.of("张飒", "张三",  "李四");
        Stream<String> streamSet = set.stream();


        System.out.println("---------------------------");

        Map<Integer, String> map =
                Map.of(1, "张飒", 2, "张三", 3, "李四");

        //map的遍历方式: 三种
        Set<Integer> set1 = map.keySet();
        Stream<Integer> streamMap = set1.stream();
        //values()
        //entrySet()


        System.out.println("--------------------------");
        //获取数组的Stream流
        Integer[] arr = {1,2,3,4,5};
        Stream<Integer> arr1 = Stream.of(arr);
    }
}
